package troopmanager.mooresr.us;

import java.sql.Date;
import java.util.HashSet;
import java.util.Set;

public class Event {
	private Integer eventId;
	private String eventName;
	private String departureLocation;
	private String destination;
	private Date departureDate;
	private Date returnDate;
	private Boolean permitFiled;
	private Boolean swimming;
	private Boolean boating;
	private Boolean climbing;
	private Boolean flying;
	private Boolean highAdventure;
	private Integer travelMiles;
	private Integer leaderId;
	private Integer asstLeaderId;
	private Set<EventSpecialFormName> specialFormNames;
	
	public Event()
	{
		specialFormNames = new HashSet<EventSpecialFormName>();
	}
	
	public Event(Integer eventId, String eventName, String departureLocation,
			String destination, Date departureDate, Date returnDate,
			Boolean permitFiled, Boolean swimming, Boolean boating,
			Boolean climbing, Boolean flying, Boolean highAdventure,
			Integer travelMiles, Integer leaderId, Integer asstLeaderId) {
		super();
		this.eventId = eventId;
		this.eventName = eventName;
		this.departureLocation = departureLocation;
		this.destination = destination;
		this.departureDate = departureDate;
		this.returnDate = returnDate;
		this.permitFiled = permitFiled;
		this.swimming = swimming;
		this.boating = boating;
		this.climbing = climbing;
		this.flying = flying;
		this.highAdventure = highAdventure;
		this.travelMiles = travelMiles;
		this.leaderId = leaderId;
		this.asstLeaderId = asstLeaderId;
		specialFormNames = new HashSet<EventSpecialFormName>();
	}
	
	public void addSpecialFormName(EventSpecialFormName formName) {
		specialFormNames.add(formName);
	}
	
	public void removeSpecialForm(String formName) {
		specialFormNames.remove(formName);
	}
	
	public Set<EventSpecialFormName> getSpecialFormNames() {
		return specialFormNames;
	}

	public Integer getEventId() {
		return eventId;
	}

	public void setEventId(Integer eventId) {
		this.eventId = eventId;
	}

	public String getEventName() {
		return eventName;
	}

	public void setEventName(String eventName) {
		this.eventName = eventName;
	}

	public String getDepartureLocation() {
		return departureLocation;
	}

	public void setDepartureLocation(String departureLocation) {
		this.departureLocation = departureLocation;
	}

	public String getDestination() {
		return destination;
	}

	public void setDestination(String destination) {
		this.destination = destination;
	}

	public Date getDepartureDate() {
		return departureDate;
	}

	public void setDepartureDate(Date departureDate) {
		this.departureDate = departureDate;
	}

	public Date getReturnDate() {
		return returnDate;
	}

	public void setReturnDate(Date returnDate) {
		this.returnDate = returnDate;
	}

	public Boolean getPermitFiled() {
		return permitFiled;
	}

	public void setPermitFiled(Boolean permitFiled) {
		this.permitFiled = permitFiled;
	}

	public Boolean getSwimming() {
		return swimming;
	}

	public void setSwimming(Boolean swimming) {
		this.swimming = swimming;
	}

	public Boolean getBoating() {
		return boating;
	}

	public void setBoating(Boolean boating) {
		this.boating = boating;
	}

	public Boolean getClimbing() {
		return climbing;
	}

	public void setClimbing(Boolean climbing) {
		this.climbing = climbing;
	}

	public Boolean getFlying() {
		return flying;
	}

	public void setFlying(Boolean flying) {
		this.flying = flying;
	}

	public Boolean getHighAdventure() {
		return highAdventure;
	}

	public void setHighAdventure(Boolean highAdventure) {
		this.highAdventure = highAdventure;
	}

	public Integer getTravelMiles() {
		return travelMiles;
	}

	public void setTravelMiles(Integer travelMiles) {
		this.travelMiles = travelMiles;
	}

	public Integer getLeaderId() {
		return leaderId;
	}

	public void setLeaderId(Integer leaderId) {
		this.leaderId = leaderId;
	}

	public Integer getAsstLeaderId() {
		return asstLeaderId;
	}

	public void setAsstLeaderId(Integer asstLeaderId) {
		this.asstLeaderId = asstLeaderId;
	}

	public String toString() {
		return this.eventName;
	}
	
	public Boolean isMedFormBRequired() {
		if (this.highAdventure) {
			return true;
		}
		
		long endTime = this.returnDate.getTime();
		long startTime = this.departureDate.getTime();
		
		long duration = endTime - startTime;
		long limit = 1000 * 60 * 60 * 72; /* 72 hours in milliseconds */
		
		if (duration > limit) {
			return true;
		} else {
			return false;
		}
	}

}
